<template>
  <div class="wrapperA" ref="wrapperA">
    <div class="contentA">
      <slot ></slot>
    </div>
  </div>
</template>

<script>
  import BScroll from 'better-scroll'
  export default {
    name: "Scroll",
    data(){
      return{
        scroll: null
      }
    },
    props: {
      probeType:{
        type:Number,
        default: 0
      },
      pullUpLoad: {
        type: Boolean,
        default: false
      }
    },
    methods: {
      refreshScroll() {
        this.scroll && this.scroll.refresh()
      },
    },
    /*updated会出现频繁返回顶部*/
    mounted() {

      this.scroll=new BScroll(this.$refs.wrapperA,{
        probeType: this.probeType,
        click: true, //点击
        pullUpLoad: this.pullUpLoad, //上拉加载更多
        mouseWheel: false
      })
      this.scroll.on('scroll',position=>{
        this.$emit('scrollEvent',position)
      })
      this.scroll.on('pullingUp',()=>{
        this.$emit("pulling")
      })
    }
  }
</script>

<style scoped>

</style>